package com.shenmazong.servertalklogin.controller;

import com.shenmazong.servertalklogin.service.IAdminService;
import com.shenmazong.utils.ResponseResult;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperationSupport;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author 田不平
 * @project demo-easytalk
 * @date 2020/9/15 5:20 PM
 * http://www.shenmazong.com
 */

@RestController
@Slf4j
@CrossOrigin(origins = "*", allowedHeaders = "*")
public class LoginController {

    @Resource
    IAdminService iAdminService;

    /**
     * TODO 管理员登录
     * @return
     */
    @PostMapping(value = "/doAdminLogin")
    public ResponseResult doAdminLogin(@RequestParam("userName") String userName,
                                       @RequestParam("userPass") String userPass) {
        return iAdminService.doAdminLogin(userName, userPass);
    }

    /**
     * TODO 教师登录
     * @return
     */
    @PostMapping(value = "/doTeacherLogin")
    public ResponseResult doTeacherLogin(@RequestParam("userName") String userName,
                                         @RequestParam("passWord") String passWord) {
        return null;
    }

    /**
     * @Description:
     * @Author: 王大勇
     * @Date: 2020/9/9 10:38
     * TODO doStudentLogin 学生登陆
     * @return: java.lang.ResponseResult
     **/
    @PostMapping("/doStudentLogin")
    @ApiOperation(value = "学生登陆", notes = "学生登陆")
    @ApiOperationSupport(order = 1)
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name="studentName", value = "学生姓名", dataType = "String", required=true),
            @ApiImplicitParam(name="studentPass", value = "密码", dataType = "String", required=true)
    })
    public ResponseResult doStudentLogin(@RequestParam("studentName") String studentName,
                                         @RequestParam("studentPass") String studentPass){
        return null;
    }

    /** TODO 销售登陆
     * @Description:
     * @Author: 尹绪瑞
     * @Date: 2020/9/9 10:39
     * @return: java.lang.ResponseResult
     **/
    @PostMapping("/doSellerLogin")
    @ApiOperation(value = "销售登陆", notes = "管理平台销售登陆")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name="userName", value = "用户名", dataType = "String", required=true),
            @ApiImplicitParam(name="passWord", value = "密码", dataType = "String", required=true)
    })
    public ResponseResult doSellerLogin(@RequestParam("userName") String userName,
                                        @RequestParam("passWord") String passWord
    ){
        return null;

    }
}
